	/*
 * Class ObjectOption1
 *
 * Version 1.0
 *
 * Friday, August 22, 2008
 *
 * Created by Palidino76
 */

package palidino76.rs2.io.packets;

import palidino76.rs2.*;;
import palidino76.rs2.player.misc.*;
import palidino76.rs2.player.Player;
import palidino76.rs2.player.skills.*;
import palidino76.rs2.player.games.*;
import palidino76.rs2.util.Misc;
import palidino76.rs2.io.Frames;
import palidino76.rs2.content.minigames.BountyHunter;
import palidino76.rs2.content.skills.runecrafting;
import palidino76.rs2.player.items.PlayerItems;
import palidino76.rs2.EventManager.*;

public class ObjectOption1 implements Packet {
public static boolean cape(Player p)
{

if(Engine.playerItems.HasItemAmount(p, 1052, 1) || Engine.playerItems.HasItemAmount(p, 6570, 1) || Engine.playerItems.HasItemAmount(p, 6568, 1)
 || Engine.playerItems.HasItemAmount(p, 9747, 1) || Engine.playerItems.HasItemAmount(p, 9748, 1) || Engine.playerItems.HasItemAmount(p, 9750, 1)
 || Engine.playerItems.HasItemAmount(p, 9751, 1) || Engine.playerItems.HasItemAmount(p, 9753, 1) || Engine.playerItems.HasItemAmount(p, 9754, 1)
 || Engine.playerItems.HasItemAmount(p, 9756, 1) || Engine.playerItems.HasItemAmount(p, 9757, 1) || Engine.playerItems.HasItemAmount(p, 9759, 1)
 || Engine.playerItems.HasItemAmount(p, 9760, 1) || Engine.playerItems.HasItemAmount(p, 9762, 1) || Engine.playerItems.HasItemAmount(p, 9763, 1)
 || Engine.playerItems.HasItemAmount(p, 9765, 1) || Engine.playerItems.HasItemAmount(p, 9766, 1) || Engine.playerItems.HasItemAmount(p, 9767, 1)
 || Engine.playerItems.HasItemAmount(p, 9769, 1) || Engine.playerItems.HasItemAmount(p, 9771, 1) || Engine.playerItems.HasItemAmount(p, 9772, 1)
 || Engine.playerItems.HasItemAmount(p, 9774, 1) || Engine.playerItems.HasItemAmount(p, 9775, 1) || Engine.playerItems.HasItemAmount(p, 9777, 1)
 || Engine.playerItems.HasItemAmount(p, 9778, 1) || Engine.playerItems.HasItemAmount(p, 9780, 1) || Engine.playerItems.HasItemAmount(p, 9781, 1)
 || Engine.playerItems.HasItemAmount(p, 9783, 1) || Engine.playerItems.HasItemAmount(p, 9784, 1) || Engine.playerItems.HasItemAmount(p, 9786, 1)
 || Engine.playerItems.HasItemAmount(p, 9787, 1) || Engine.playerItems.HasItemAmount(p, 9789, 1) || Engine.playerItems.HasItemAmount(p, 9790, 1)
 || Engine.playerItems.HasItemAmount(p, 9792, 1) || Engine.playerItems.HasItemAmount(p, 9793, 1) || Engine.playerItems.HasItemAmount(p, 9795, 1)
 || Engine.playerItems.HasItemAmount(p, 9796, 1) || Engine.playerItems.HasItemAmount(p, 9798, 1) || Engine.playerItems.HasItemAmount(p, 9799, 1)
 || Engine.playerItems.HasItemAmount(p, 9801, 1) || Engine.playerItems.HasItemAmount(p, 9802, 1) || Engine.playerItems.HasItemAmount(p, 9804, 1)
 || Engine.playerItems.HasItemAmount(p, 9805, 1) || Engine.playerItems.HasItemAmount(p, 9807, 1) || Engine.playerItems.HasItemAmount(p, 9808, 1)
 || Engine.playerItems.HasItemAmount(p, 9810, 1) || Engine.playerItems.HasItemAmount(p, 9811, 1) || Engine.playerItems.HasItemAmount(p, 9813, 1)

 || Engine.playerItems.HasItemAmount(p, 1038, 1) || Engine.playerItems.HasItemAmount(p, 1040, 1) || Engine.playerItems.HasItemAmount(p, 1042, 1)
 || Engine.playerItems.HasItemAmount(p, 1044, 1) || Engine.playerItems.HasItemAmount(p, 1046, 1) || Engine.playerItems.HasItemAmount(p, 1048, 1)
 || Engine.playerItems.HasItemAmount(p, 1050, 1) || Engine.playerItems.HasItemAmount(p, 1053, 1) || Engine.playerItems.HasItemAmount(p, 1055, 1)
 || Engine.playerItems.HasItemAmount(p, 1057, 1) || Engine.playerItems.HasItemAmount(p, 1149, 1) || Engine.playerItems.HasItemAmount(p, 1155, 1)
 || Engine.playerItems.HasItemAmount(p, 1157, 1) || Engine.playerItems.HasItemAmount(p, 1159, 1) || Engine.playerItems.HasItemAmount(p, 1161, 1)
 || Engine.playerItems.HasItemAmount(p, 1163, 1) || Engine.playerItems.HasItemAmount(p, 1165, 1) || Engine.playerItems.HasItemAmount(p, 4716, 1)
 || Engine.playerItems.HasItemAmount(p, 4708, 1) || Engine.playerItems.HasItemAmount(p, 4724, 1) || Engine.playerItems.HasItemAmount(p, 4732, 1)
 || Engine.playerItems.HasItemAmount(p, 4745, 1) || Engine.playerItems.HasItemAmount(p, 4753, 1) || Engine.playerItems.HasItemAmount(p, 11335, 1)
 || Engine.playerItems.HasItemAmount(p, 10828, 1) || Engine.playerItems.HasItemAmount(p, 10334, 1) || Engine.playerItems.HasItemAmount(p, 10342, 1)
 || Engine.playerItems.HasItemAmount(p, 10350, 1) || Engine.playerItems.HasItemAmount(p, 2639, 1) || Engine.playerItems.HasItemAmount(p, 2641, 1)
 || Engine.playerItems.HasItemAmount(p, 2743, 1) || Engine.playerItems.HasItemAmount(p, 2581, 1) || Engine.playerItems.HasItemAmount(p, 12210, 1)
 || Engine.playerItems.HasItemAmount(p, 12213, 1) || Engine.playerItems.HasItemAmount(p, 12216, 1) || Engine.playerItems.HasItemAmount(p, 12219, 1)
 || Engine.playerItems.HasItemAmount(p, 12222, 1) || Engine.playerItems.HasItemAmount(p, 9749, 1) || Engine.playerItems.HasItemAmount(p, 9752, 1)
 || Engine.playerItems.HasItemAmount(p, 9755, 1) || Engine.playerItems.HasItemAmount(p, 9758, 1) || Engine.playerItems.HasItemAmount(p, 9761, 1)
 || Engine.playerItems.HasItemAmount(p, 9764, 1) || Engine.playerItems.HasItemAmount(p, 9767, 1) || Engine.playerItems.HasItemAmount(p, 9770, 1)
 || Engine.playerItems.HasItemAmount(p, 9773, 1) || Engine.playerItems.HasItemAmount(p, 9776, 1) || Engine.playerItems.HasItemAmount(p, 9779, 1)
 || Engine.playerItems.HasItemAmount(p, 9782, 1) || Engine.playerItems.HasItemAmount(p, 9785, 1) || Engine.playerItems.HasItemAmount(p, 9788, 1)
 || Engine.playerItems.HasItemAmount(p, 9791, 1) || Engine.playerItems.HasItemAmount(p, 9794, 1) || Engine.playerItems.HasItemAmount(p, 9797, 1)
 || Engine.playerItems.HasItemAmount(p, 9800, 1) || Engine.playerItems.HasItemAmount(p, 9803, 1) || Engine.playerItems.HasItemAmount(p, 9806, 1)
 || Engine.playerItems.HasItemAmount(p, 9809, 1) || Engine.playerItems.HasItemAmount(p, 9812, 1) || Engine.playerItems.HasItemAmount(p, 9814, 1)
)
{
return true;
}
else
{
return false;
}
}
    /*
     * make sure to document EVERY coordinate to go with each object unless an un-important object(wilderness ditch lol).
     * This will prevent people from spawning an object client side and actually using it.
     * So make sure to include with the id, objectX == # && objectY == #
    */

    /**
     * Handles the first option on objects.
     * @param p The Player which the frame should be handled for.
     * @param packetId The packet id this belongs to.
     * @param packetSize The amount of bytes being recieved for this packet.
     */
    public void handlePacket(Player p, int packetId, int packetSize) {
        if (p == null || p.stream == null) {
            return;
        }
        if (!p.objectOption1) {
            p.clickX = p.stream.readUnsignedWordBigEndian();
            p.clickId = p.stream.readUnsignedWord();
            p.clickY = p.stream.readUnsignedWordBigEndianA();
            if (Misc.getDistance(p.absX, p.absY, p.clickX, p.clickY) > 3 && p.clickId != 26303) {
                return;
            }
            p.objectOption1 = true;
        }
        p.objectOption1 = false;
	PlayerMethods pm = new PlayerMethods(p);
	PlayerItems pi = new PlayerItems();
	FightCave fCave = new FightCave(p);
	runecrafting runecrafting = new runecrafting();
	System.out.println("x "+p.clickX+" y: "+p.clickY);
	System.out.println("ClickId: "+p.clickId+".");
	//p.frequestFaceTo(p.clickId);

        switch (p.clickId) {
		case 2295:
p.clickDelay = 4;
p.frames.removeChatboxInterface(p);
p.addSkillXP(7262, 16);
	  p.isJumping = false;
		if (p.absY > p.clickY) {
		p.reqWalkQueueBack(p.absX, p.clickY - 7);
	  }
		if (p.absY < p.clickY) {
}
break;
case 2285:
p.frames.removeChatboxInterface(p);
p.addSkillXP(7262, 16);
p.setCoords(p.absX, 3424, 1);
break;
case 35970:
p.frames.removeChatboxInterface(p);
p.addSkillXP(7262, 16);
p.setCoords(p.absX, 3420, 2);
break;
case 2312:
p.clickDelay = 4;
p.frames.removeChatboxInterface(p);
p.addSkillXP(7262, 16);
p.isJumping = false;
//p.reqWalkQueue(2483, 3420);
p.reqWalkQueueX(p.clickX + 7, p.absY);
break;
case 2314:
p.frames.removeChatboxInterface(p);
p.addSkillXP(7262, 16);
p.setCoords(2485, 3419, 0);
break;
case 2286:
p.clickDelay = 4;
p.frames.removeChatboxInterface(p);
p.addSkillXP(1500, 16);
	  p.isJumping = true;
		p.reqWalkQueue(p.absX, p.clickY + 1);
break;
case 154:
		case 409:
			p.clickDelay = 4;
			if (p.skillLvl[5] != p.getLevelForXP(5)) {
				p.requestAnim(645, 0);
				p.skillLvl[5] = p.getLevelForXP(5);
				p.frames.sendMessage(p, "You restore your prayer points.");
			} else {
				p.frames.sendMessage(p, "Your prayer points are still full.");
			}
			p.frames.setSkillLvl(p, 5);
			p.appearanceUpdateReq = true;
			p.updateReq = true;
		break;
case 4058:
p.clickDelay = 4;
p.frames.removeChatboxInterface(p);
p.addSkillXP(7262, 16);
p.reqWalkQueue(p.absX, p.clickY + 6);
p.requestAnim(749, 0);
break;
		case 355:
		case 356:
		case 366:
			p.frames.sendMessage(p, "You search the crate and find nothing of interest.");
		break;
		case 354:
		if (p.StraightChamp == 100 && p.SCSSpawn == 0) {
			Server.engine.newNPC(3616, 3350, 2948, 0, 0, 0, 0, 0, false, 0);
			p.SCSSpawn = 1;
			p.disconnected[1] = false;
		} else if (p.StraightChamp == 100 && p.SCSSpawn == 1) {
			p.frames.sendMessage(p, "You must kill Asyn before you can search this crate.");
		} else if (p.StraightChamp == 100 && p.SCSSpawn == 2) {
			p.frames.sendMessage(p, "You search the crate...");
			p.frames.showChatboxInterface(p, 307);
			p.frames.addInterfaceItem(p, 307, 2, 175, 4078);
			p.frames.setString(p, "You find Zealot's Key!", 307, 7);
			Engine.playerItems.addItem(p, 4078, 1);
			p.SCSSpawn = 3;
			p.StraightChamp = 150;
			p.disconnected[1] = false;
		} else {
			p.frames.sendMessage(p, "You search the crate and find nothing of interest.");
		}
		break;
		case 1528:
		if (p.absX == 3350 && p.absY == 2957) {		
			p.setCoords(3350, 2956, 0);
		} else if (p.absX == 3350 && p.absY == 2956) {
			p.setCoords(3350, 2957, 0);
		}
		break;
		case 15536:
			p.frames.createGlobalObject(15536, 0, 3192, 3354, 0, 0);
		break;
		case 1805:
			p.frames.createGlobalObject(1805, 0, 3191, 3363, 0, 0);
		break;
case 26194:
if (p.username.equalsIgnoreCase("unleashed")) {
Engine.playerItems.addItem(p, 3801, 1);
pi.deleteItem(p,3801,pi.getItemSlot(p,3801),1);
p.frames.createGlobalObject(115, p.heightLevel, 3049, 3376, 0, 10);
p.frames.createGlobalObject(115, p.heightLevel, 3043, 3381, 0, 10);
p.frames.createGlobalObject(115, p.heightLevel, 3039, 3378, 0, 10);
p.frames.createGlobalObject(115, p.heightLevel, 3054, 3379, 0, 10);
p.frames.createGlobalObject(116, p.heightLevel, 3051, 2278, 0, 10);
p.frames.createGlobalObject(116, p.heightLevel, 3052, 3373, 0, 10);
p.frames.createGlobalObject(116, p.heightLevel, 3046, 3383, 0, 10);
p.frames.createGlobalObject(116, p.heightLevel, 3041, 3383, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3039, 3380, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3041, 3378, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3045, 3377, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3046, 3374, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3042, 3373, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3050, 3378, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3047, 3380, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3050, 3383, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3045, 3382, 0, 10);
p.frames.createGlobalObject(117, p.heightLevel, 3042, 3379, 0, 10);
p.frames.createGlobalObject(118, p.heightLevel, 3044, 3373, 0, 10);
p.frames.createGlobalObject(118, p.heightLevel, 3047, 3373, 0, 10);
p.frames.createGlobalObject(118, p.heightLevel, 3042, 3384, 0, 10);
p.frames.createGlobalObject(118, p.heightLevel, 3037, 3382, 0, 10);
p.frames.createGlobalObject(119, p.heightLevel, 3036, 3382, 0, 10);
p.frames.createGlobalObject(119, p.heightLevel, 3039, 3375, 0, 10);
p.frames.createGlobalObject(119, p.heightLevel, 3048, 3374, 0, 10);
p.frames.createGlobalObject(119, p.heightLevel, 3047, 3376, 0, 10);
p.frames.createGlobalObject(120, p.heightLevel, 3050, 3374, 0, 10);
p.frames.createGlobalObject(120, p.heightLevel, 3053, 3377, 0, 10);
p.frames.createGlobalObject(120, p.heightLevel, 3051, 3384, 0, 10);
p.frames.createGlobalObject(120, p.heightLevel, 3048, 3384, 0, 10);
p.frames.createGlobalObject(121, p.heightLevel, 3044, 3377, 0, 10);
p.frames.createGlobalObject(121, p.heightLevel, 3046, 3380, 0, 10);
p.frames.createGlobalObject(121, p.heightLevel, 3045, 3379, 0, 10);
p.frames.createGlobalObject(121, p.heightLevel, 3054, 3371, 0, 10);
p.frames.createGlobalObject(122, p.heightLevel, 3052, 3375, 0, 10);
p.frames.createGlobalObject(122, p.heightLevel, 3049, 3375, 0, 10);
p.frames.createGlobalObject(122, p.heightLevel, 3048, 3377, 0, 10);
p.frames.createGlobalObject(122, p.heightLevel, 3043, 3381, 0, 10);
break;
} else {
p.frames.sendMessage(p, "You Are Not Unleashed. He Is The Only One Who Can Inititiate Drop Parties.");
break;
}

case 115:
p.requestAnim(10017, 0);
p.frames.createGlobalObject(123, p.heightLevel, p.clickX, p.clickY, 0, 10);
            Engine.items.createGroundItem(Misc.random(12000), 1, p.clickX, p.clickY, p.heightLevel, p.username);
break;
case 116:
p.requestAnim(10017, 0);
p.frames.createGlobalObject(124, p.heightLevel, p.clickX, p.clickY, 0, 10);
            Engine.items.createGroundItem(Misc.random(12000), 1, p.clickX, p.clickY, p.heightLevel, p.username);
break;
case 117:
p.requestAnim(10017, 0);
p.frames.createGlobalObject(125, p.heightLevel, p.clickX, p.clickY, 0, 10);
break;
case 118:
            Engine.items.createGroundItem(Misc.random(12000), 1, p.clickX, p.clickY, p.heightLevel, p.username);
p.requestAnim(10017, 0);
p.frames.createGlobalObject(126, p.heightLevel, p.clickX, p.clickY, 0, 10);
break;
case 119:
p.requestAnim(10017, 0);
p.frames.createGlobalObject(127, p.heightLevel, p.clickX, p.clickY, 0, 10);
            Engine.items.createGroundItem(Misc.random(12000), 1, p.clickX, p.clickY, p.heightLevel, p.username);
break;
case 120:
p.requestAnim(10017, 0);
p.frames.createGlobalObject(128, p.heightLevel, p.clickX, p.clickY, 0, 10);
            Engine.items.createGroundItem(Misc.random(12000), 1, p.clickX, p.clickY, p.heightLevel, p.username);
break;
case 121:
p.requestAnim(10017, 0);
p.frames.createGlobalObject(129, p.heightLevel, p.clickX, p.clickY, 0, 10);
            Engine.items.createGroundItem(Misc.random(12000), 1, p.clickX, p.clickY, p.heightLevel, p.username);
break;
case 122:
p.requestAnim(10017, 0);
p.frames.createGlobalObject(130, p.heightLevel, p.clickX, p.clickY, 0, 10);
            Engine.items.createGroundItem(Misc.random(12000), 1, p.clickX, p.clickY, p.heightLevel, p.username);
break;
case 23921:
p.requestAnim(433, 0);
p.addSkillXP(8, 0);
p.frames.sendMessage(p, "You hit the dummy.");
break;
case 6552:
p.clickDelay = 3;
p.requestAnim(645, 0);
p.frames.setTab(p, 79, 192);
p.frames.sendMessage(p, "You feel a strange ancient knowledge come over you.");
p.frames.sendMessage(p, "To convert back to regular magics type ::normal .");
break;
case 26808:
if(p.absX == 3103 && p.absY == 3499)
{
p.setCoords(3104, 3499, 0);
}
if(p.absX == 3104 && p.absY == 3499)
{
p.setCoords(3103, 3499, 0);
}
break;
		//BEGINNING OF CASTLEWARS FOR ObjectOption1.java//
case 4387://cw sara portal
if(p.equipment[1] > 0 && p.equipmentN[1] > 0) 
{ 
p.frames.sendMessage(p, "You cannot be wearing a cape.");
}
else
if(p.equipment[0] > 0 && p.equipmentN[0] > 0) 
{ 
p.frames.sendMessage(p, "You cannot be wearing anything on your head.");
}
else
if(Engine.CWGameTime > 0)
{ 
p.frames.sendMessage(p, "The Game has already begun. Please wait for the next game.");
}
else
if(cape(p) == true)
{
p.frames.sendMessage(p, "You cannot bring capes or hats into the game.");
}
else if(Engine.ZamorakTeam < Engine.SaradominTeam)
{
p.frames.sendMessage(p, "This team has more players than the other.");
}
else
{
p.equipment[1] = 4041; 
p.equipmentN[1] = 1; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
p.setCoords(2377+Misc.random(4), 9486+Misc.random(4), 0);
p.frames.sendMessage(p, "You join Saradomin's side.");
}
break;

case 4408:
if(p.equipment[1] > 0 && p.equipmentN[1] > 0) 
{ 
p.frames.sendMessage(p, "You cannot be wearing a cape.");
}
else
if(p.equipment[0] > 0 && p.equipmentN[0] > 0) 
{ 
p.frames.sendMessage(p, "You cannot be wearing anything on your head.");
}
else
if(Engine.CWGameTime > 0) 
{ 
p.frames.sendMessage(p, "The Game has already begun. Please wait for the next game.");
}
else
if(cape(p) == true)
{
p.frames.sendMessage(p, "You cannot bring capes or hats into the game.");
}
else
{
if(Engine.ZamorakTeam > Engine.SaradominTeam || Engine.ZamorakTeam == Engine.SaradominTeam)
{
p.equipment[1] = 4041; 
p.equipmentN[1] = 1; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
p.setCoords(2377+Misc.random(4), 9486+Misc.random(4), 0);
p.frames.sendMessage(p, "You join Saradomin's side..");
}
else if(Engine.ZamorakTeam < Engine.SaradominTeam)
{
p.equipment[1] = 4042; 
p.equipmentN[1] = 1; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
p.setCoords(2420+Misc.random(4), 9521+Misc.random(4), 0);
p.frames.sendMessage(p, "You join Zamorak's side..");
}
}
break;
case 4388:
if(p.equipment[1] > 0 && p.equipmentN[1] > 0) 
{ 
p.frames.sendMessage(p, "You cannot be wearing a cape.");
}
else
if(p.equipment[0] > 0 && p.equipmentN[0] > 0) 
{ 
p.frames.sendMessage(p, "You cannot be wearing anything on your head.");
}
else
if(Engine.CWGameTime > 0) 
{ 
p.frames.sendMessage(p, "The Game has already begun. Please wait for the next game.");
}
else
if(cape(p) == true)
{
p.frames.sendMessage(p, "You cannot bring capes or hats into the game.");
}
else if(Engine.ZamorakTeam < Engine.SaradominTeam)
{
p.frames.sendMessage(p, "This team has already enough players.");
}
else
{
p.equipment[1] = 4042; 
p.equipmentN[1] = 1; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
p.setCoords(2420+Misc.random(4), 9521+Misc.random(4), 0);
p.frames.sendMessage(p, "You join Zamorak's side..");
}
break;



case 4902:
if(p.CWTeam == 0 && p.equipment[3] == 4039)
{
Engine.SaradominScore += 1;
Engine.ZamorakFlag = false;
Engine.ZamorakP = 0;
p.equipment[3] = -1; 
p.equipmentN[3] = 0; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
for(Player pg : Engine.players) {
p.frames.sendMessage(pg, Misc.optimizeText(p.username)+" scored a point for Saradomin.");
}
}
else
if(Engine.SaradominFlag == true)
{
p.frames.sendMessage(p, "The flag has already been taken.");
}
else
if(p.CWTeam == 1)
{
Engine.SaradominP = p.playerId;
Engine.SaradominFlag = true;
Engine.playerItems.addItem(p, p.equipment[3], 1);
p.equipment[3] = 4037; 
p.equipmentN[3] = 1; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
p.frames.sendMessage(p, "You take Saradomin's flag.");
}
else
{
p.frames.sendMessage(p, "This is your flag.");
}
break;

case 4903:
if(p.CWTeam == 1 && p.equipment[3] == 4037)
{
Engine.ZamorakScore += 1;
Engine.SaradominFlag = false;
Engine.SaradominP = 0;
p.equipment[3] = -1; 
p.equipmentN[3] = 0; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
for(Player pg : Engine.players) {
p.frames.sendMessage(pg, Misc.optimizeText(p.username)+" scored a point for Zamorak.");
}
}
else
if(Engine.ZamorakFlag == true)
{
p.frames.sendMessage(p, "The flag has already been taken.");
}
else
if(p.CWTeam == 0)
{
Engine.ZamorakP = p.playerId;
Engine.ZamorakFlag = true;
Engine.playerItems.addItem(p, p.equipment[3], 1);
p.equipment[3] = 4039; 
p.equipmentN[3] = 1; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
p.frames.sendMessage(p, "You take Zamorak's flag.");
}
else
{
p.frames.sendMessage(p, "This is your flag.");
}
break;

case 4407:
case 4390:
case 4406:
case 4389:
p.setCoords(2440+Misc.random(4), 3085+Misc.random(10), 0);
p.OverTimer = 2;
p.equipment[1] = -1; 
p.equipmentN[1] = 0; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
if(p.equipment[3] == 4037 && p.CWTeam == 1)
{
Engine.SaradominFlag = false;
p.equipment[3] = -1; 
p.equipmentN[3] = 0; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
}
if(p.equipment[3] == 4039 && p.CWTeam == 0)
{
Engine.ZamorakFlag = false;
p.equipment[3] = -1; 
p.equipmentN[3] = 0; 
p.appearanceUpdateReq = true; 
p.updateReq = true; 
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
}
break;

case 4484:
p.frames.showChatboxInterface(p, 55);
p.frames.setString(p, "Saradomin: "+Engine.SaradominScore, 55, 1);
p.frames.setString(p, "Zamorak: "+Engine.ZamorakScore, 55, 2);
break;

case 36575://Barricade table (saradomin)
Engine.playerItems.addItem(p, 4053, 1);
break;
case 36582://Barricade table (zamorak)
Engine.playerItems.addItem(p, 4053, 1);
break;
case 36577://Explode potion table(saradomin)
Engine.playerItems.addItem(p, 4045, 1);
break;

case 36584://Explode potion table(zamorak)
Engine.playerItems.addItem(p, 4045, 1);
break;

case 36576://Rope table(saradomin)
Engine.playerItems.addItem(p, 954, 1);
break;
case 36583://Rope table(zamorak)
Engine.playerItems.addItem(p, 954, 1);
break;


case 36573:// Toolkit table (saradomin)
Engine.playerItems.addItem(p, 4051, 1);
break;
case 36580:// Toolkit table (zamorak)
Engine.playerItems.addItem(p, 4051, 1);
break;

case 36574:// Rock table(saradomin)
Engine.playerItems.addItem(p, 4043, 1);
break;
case 36581:// Rock table(zamorak)
Engine.playerItems.addItem(p, 4043, 1);
break;
case 36585:// pick table(zamorak)
Engine.playerItems.addItem(p, 1265, 1);
break;

case 36578:
Engine.playerItems.addItem(p, 1265, 1);
break;


case 4469://cw sara barrier 
if(p.absX == 2426 && p.absY == 3080)
{
p.setCoords(2426, 3081, 1);
}
if(p.absX == 2426 && p.absY == 3081 && p.CWTeam == 0)
{
p.setCoords(2426, 3080, 1);
}
if(p.absX == 2423 && p.absY == 3076)
{
p.setCoords(2422, 3076, 1);
}
if(p.absX == 2422 && p.absY == 3076 && p.CWTeam == 0)
{
p.setCoords(2423, 3076, 1);
}
break;

case 36484://cw sara stairs
p.setCoords(2426, 3074, 3);
break;
case 4470://cw zammy barrier 
if(p.absX == 2373 && p.absY == 3127)
{
p.setCoords(2373, 3126, 1);
}
if(p.absX == 2373 && p.absY == 3126 && p.CWTeam == 1)
{
p.setCoords(2373, 3127, 1);
}
if(p.absX == 2376 && p.absY == 3131)
{
p.setCoords(2377, 3131, 1);
}
if(p.absX == 2377 && p.absY == 3131 && p.CWTeam == 1)
{
p.setCoords(2376, 3131, 1);
}
break;


case 4467://zammy door
if(p.absX == 2385 && p.absY == 3134)
{
p.setCoords(2384, 3134, 0);
}
if(p.absX == 2384 && p.absY == 3134)
{
p.setCoords(2385, 3134, 0);
}
break;
case 36521://cw zammy stairs
p.setCoords(2369, 3127, 2);
break;



case 36540:
case 4415://cw sara down staircase
if(p.absX == 2420 && p.absY == 3080)
{
p.setCoords(2419, 3077, 0);
}
if(p.absX == 2430 && p.absY == 3080)
{
p.setCoords(2427, 3081, 1);
}
if(p.absX == 2426 && p.absY == 3074)
{
p.setCoords(2425, 3077, 2);
}
if(p.absX == 2416 && p.absY == 3075)
{
p.setCoords(2417, 3078, 0);
}
if(p.absX == 2382 && p.absY == 3129)
{
p.setCoords(2383, 3132, 0);
}
if(p.absX == 2379 && p.absY == 3127)
{
p.setCoords(2380, 3130, 0);
}
if(p.absX == 2369 && p.absY == 3127)
{
p.setCoords(2372, 3126, 1);
}
if(p.absX == 2373 && p.absY == 3133)
{
p.setCoords(2374, 3130, 2);
}
if(p.absX == 2383 && p.absY == 3132)
{
p.setCoords(2382, 3129, 0);
}
break;


case 36532://cw zammy up staircase
p.setCoords(2379, 3127, 1);
break;

case 36523://cw zammy  stairs
p.setCoords(2373, 3133, 3);
break;

case 36480://cw sara up steps
p.setCoords(2430, 3080, 2);
break;



case 4465://cw sara door(unlock)
if(p.absX == 2414 && p.absY == 3073)
{
p.setCoords(2415, 3073, 0);
}
if(p.absX == 2415 && p.absY == 3073)
{
p.setCoords(2414, 3073, 0);
}
break;

case 36579://cw sara bandages
Engine.playerItems.addItem(p, 4049, 1);
p.requestAnim(881, 0);
break;
case 36586://cw zammy bandages
Engine.playerItems.addItem(p, 4049, 1);
p.requestAnim(881, 0);
break;



case 36481://cw sara steps(to catapult)
p.setCoords(2415, 3075, 0);
break;

case 36495://cw sara steps(to starting room)
p.setCoords(2420, 3080, 1);
break;
//END OF CASTLEWARS FOR ObjectOption1.java//
		case 9369:
if(p.absX == 2399 && p.absY == 5177)
{
p.setCoords(2399, 5175,0);
p.OverTimer = 5;
p.frames.setOverlay(p, 653);
}
if(p.absX == 2399 && p.absY == 5175)
{
p.setCoords(2399, 5177,0);
p.OverTimer = 5;
p.frames.removeOverlay(p);
}

break;
case 9368:
if(p.absX == 2399 && p.absY == 5167)
{
p.setCoords(2399, 5169,0);
p.OverTimer = 5;
}
break;
		            case 2479://mind altar
            {
	    p.runecrafting.runecrafting(p, 2, 35, 558, 14, 28, 42, 56, 70, 84, 98, 150, 150);
            }
                break;
             case 2480:
             {
            p.runecrafting.runecrafting(p, 5, 40, 555, 19, 38, 57, 76, 95, 150, 150, 150, 150);
             }
                break;
            case 2481:
            {
            p.runecrafting.runecrafting(p, 9, 45, 557, 26, 52, 78, 150, 150, 150, 150, 150, 150);
            }
                break;
            case 2482:
            {
            p.runecrafting.runecrafting(p, 14, 50, 554, 35, 70, 150, 150, 150, 150, 150, 150, 150);
            }
                break;
            case 2483:
            {
            p.runecrafting.runecrafting(p, 20, 45, 559, 46, 92, 150, 150, 150, 150, 150, 150, 150);
            }
                break;
            case 2484:
            {
            p.runecrafting.runecrafting(p, 27, 65, 564, 59, 150, 150, 150, 150, 150, 150, 150, 150);
            }
                break;
            case 2485:
            {
            p.runecrafting.runecrafting(p, 54, 140, 563, 150, 150, 150, 150, 150, 150, 150, 150, 150);
            }
                break;
            case 2486:
            {
            p.runecrafting.runecrafting(p, 44, 120, 561, 91, 150, 150, 150, 150, 150, 150, 150, 150);
            }
                break;
            case 2487:
            {
            p.runecrafting.runecrafting(p, 35, 78, 562, 74, 150, 150, 150, 150, 150, 150, 150, 150);
            }
                break;
            case 2488:
            {
            p.runecrafting.runecrafting(p, 65, 150, 560, 150, 150, 150, 150, 150, 150, 150, 150, 150);
            }
                break;
           case 7134: //Chaos
                p.teleportTo(2281, 4837, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7135: //Law
                p.teleportTo(2464, 4818, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7136: //Death
                p.teleportTo(2208, 4830, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7137: //Water
                p.teleportTo(3494, 4831, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7138: //Astral
                p.teleportTo(2154, 3866, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7139: //Air
                p.teleportTo(2793, 4828, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7140: //Mind
                p.teleportTo(2793, 4828, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7131: //Body
                p.teleportTo(2521, 4834, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7130: //Earth
                p.teleportTo(2655, 4830, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7129: //Fire
                p.teleportTo(2577, 4845, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7132: //Cosmic
                p.teleportTo(2162, 4833, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
            case 7133: //Nature
                p.teleportTo(2400, 4835, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
                break;
						case 1309: /* Yews */
				Engine.woodpatch.switchTree(p, 1309);
				p.requestFaceTo(32768 + 1309);
				break;
				case 1306:
				Engine.woodpatch.switchTree(p, 1306);
				p.requestFaceTo(32768 + 1306);
				break;
				case 1308:
				Engine.woodpatch.switchTree(p, 1308);
				p.requestFaceTo(32768 + 1308);
				break;
				case 1281:
				Engine.woodpatch.switchTree(p, 1281);
				p.requestFaceTo(32768 + 1281);
				break;
				case 1276:
Engine.woodpatch.switchTree(p, 1276);
				p.requestFaceTo(32768 + 1276);
				case 1277:
Engine.woodpatch.switchTree(p, 1277);
				p.requestFaceTo(32768 + 1277);
				case 1278:
Engine.woodpatch.switchTree(p, 1278);
				p.requestFaceTo(32768 + 1278);
				case 1279:
Engine.woodpatch.switchTree(p, 1279);
				p.requestFaceTo(32768 + 1279);
				case 1280:
				Engine.woodpatch.switchTree(p, 1280);
				p.requestFaceTo(32768 + 1280);
				break;
		case 3829:
			p.setCoords(3228, 3106, 0);
		break;
		        case 11933:
        case 11934:
        case 11935:
        case 11957:
        case 11958:
        case 11959: //Tin
             p.oreType = 1;
             p.isMining = true;
             p.getMining().createMiningEvent();
             break;
        case 11936:
        case 11937:
        case 11938:
        case 11960:
    case 11961:
    case 11962: //Copper
             p.oreType = 2;
             p.isMining = true;
             p.getMining().createMiningEvent();
             break;
        case 37307:
        case 37308:
        case 37309:
        case 11954:
        case 11955:
        case 11956: //Iron
                 p.oreType = 3;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
             break;
        case 2311:
        case 37304:
        case 37305:
        case 37306: //Silver
                 p.oreType = 4;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
             break;
        case 11930:
        case 11931:
        case 11932: //Coal
                 p.oreType = 5;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
             break;
        case 37310:
        case 37312: //Gold
                 p.oreType = 6;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
             break;
        case 15576:
                 p.oreType = 6;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
             break;
        case 15578:
                 p.oreType = 6;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
             break;
        case 15577:
                 p.oreType = 6;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
             break;	
        case 11942:
        case 11943:
        case 11944: //Mithrill
                 p.oreType = 7;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
             break;
        case 11939:
        case 11941: //Adamantite
                 p.oreType = 8;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
             break;
        case 14860:
                 p.oreType = 9;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
              break;
        case 14859:
                 p.oreType = 9;
                 p.isMining = true;
                 p.getMining().createMiningEvent();
              break;
		case 28115:
		p.frames.showInterface(p,655);
		break;
		case 28116:
		p.frames.showInterface(p,654);
		break;
		case 15653:
		if (p.skillLvl[0] >= 60 && p.skillLvl[2] >= 60 && p.skillLvl[1] >= 40) {
			p.setCoords(2876, 3546, 0);
		} else if (p.skillLvl[0] < 60 && p.skillLvl[2] < 60 && p.skillLvl[1] < 40) {
		   	p.frames.showChatboxInterface(p, 241);
            p.frames.animateInterfaceId(p, 9847, 241, 2);
            p.frames.setNPCId(p, 4285, 241, 2);
            p.frames.setString(p, "Ghommal", 241, 3);
            p.frames.setString(p, "Sorry your stats are to low to enter the Warriors Guild.", 241, 4);
			p.NpcDialogue = 0;
			p.NpcDialogueSend = true;
		}
			break;
		

		case 26910:
			p.frames.addStaticObject(1516, -3, 3101, 3509, 0, 10);
			break;

		case 26913:
			p.frames.addStaticObject(1516, -3, 3101, 3510, 0, 10);
			break;
		
		case 35544:
		case 35542:
		case 35543:
			if (p.absX == 3304 && p.absY == 3117 && p.heightLevel == 0 && Engine.playerItems.HasItemAmount(p, 1854, 1) == true) {
				p.setCoords(3304, 3115, 0);
				Engine.playerItems.deleteItem(p, 1854, 1);
			} else if (p.absX == 3304 && p.absY == 3117 && p.heightLevel == 0 && Engine.playerItems.HasItemAmount(p, 1854, 1) == false) {
				p.frames.showChatboxInterface(p, 241);
				p.frames.animateInterfaceId(p, 9847, 241, 2);
				p.frames.setNPCId(p, 838, 241, 2);
				p.frames.setString(p, "Shantay Guard", 241, 3);
				p.frames.setString(p, "I cannot let you go through without a Shantay Pass.", 241, 4);
			} else if (p.absX == 3304 && p.absY == 3115 && p.heightLevel == 0) {
				p.setCoords(3304, 3117, 0);
			}
		break;

		case 10529:
			if (p.absX == 3445 && p.absY == 3554 && p.heightLevel == 2)
				p.setCoords(3445, 3555, 2);
			else if (p.absX == 3445 && p.absY == 3555 && p.heightLevel == 2)
				p.setCoords(3445, 3554, 2);
		break;

		case 28214:
			p.blackTeam = false;
			p.whiteTeam = false;
			p.setCoords(3266 + Misc.random(3), 3683 + Misc.random(3), 0);
			p.frames.sendMessage(p, "You step into the portal and leave the clan.");
		break;

		case 28213:
			if (p.absX == 3270 && p.absY == 3675 || p.absX == 3271 && p.absY == 3675 || p.absX == 3272 && p.absY == 3675 ||
				p.absX == 3273 && p.absY == 3675) {
				p.whiteTeam = false;
				p.blackTeam = true;
				p.frames.sendMessage(p, "Welcome to the Black clan.");
				p.frames.sendMessage(p, "The game starts in " + Server.clanWaitDelay / 2 + " seconds.");
				p.frames.sendMessage(p, "The game ends in " + Server.clanFightDelay / 2 + " seconds.");
			} else if (p.absX == 3271 && p.absY == 3692 || p.absX == 3272 && p.absY == 3692 || p.absX == 3273 && p.absY == 3692) {
				p.blackTeam = false;
				p.whiteTeam = true;
				p.frames.sendMessage(p, "Welcome to the White clan.");
				p.frames.sendMessage(p, "The game starts in " + Server.clanWaitDelay / 2 + " seconds.");
				p.frames.sendMessage(p, "The game ends in " + Server.clanFightDelay / 2 + " seconds.");
			}
		break;

		case 14109:
		break;

		case 26293:
		break;

		case 23610:
		p.frames.showInterface(p, 561);
		break;

		case 9356:
			p.setCoords(2412, 5117, p.playerId * 4);
			p.frames.showChatboxInterface(p, 241);
            p.frames.animateInterfaceId(p, 9847, 241, 2);
            p.frames.setNPCId(p, 2617, 241, 2);
            p.frames.setString(p, "TzHaar-Mej-Jal", 241, 3);
            p.frames.setString(p, "Prepare to fight for your life!", 241, 4);
			p.NpcDialogue = 0;
			p.NpcDialogueSend = true;
			p.waveDelay = 20;
			p.waveCount = 0;
		break;
		
		case 9357:
			p.setCoords(2438, 5168, 0);
		break;

		case 3831:
			p.setCoords(3483, 9509, 2);
		break;

		case 15116:
			p.setCoords(3227, 3103, 0);
		break;

		case 23596:
			p.frames.showChatboxInterface(p, 64);
			p.frames.animateInterfaceId(p, 9785, 64, 2);
			p.frames.setPlayerHead(p, 64, 2);
			p.frames.setString(p, Misc.optimizeText(p.username), 64, 3);
			p.frames.setString(p, "This tunnel does not look safe.", 64, 4);
		break;

		case 15647:
			if (p.absX == 2842 && p.absY == 3541 && p.heightLevel == 1)
				p.setCoords(2842, 3540, 1);
			else if (p.absX == 2842 && p.absY == 3540 && p.heightLevel == 1)
				p.setCoords(2842, 3541, 1);
		break;

		case 1530:
			if (p.absX == 2838 && p.absY == 3539 && p.heightLevel == 1)
				p.setCoords(2838, 3538, 1);
			else if (p.absX == 2838 && p.absY == 3538 && p.heightLevel == 1)
				p.setCoords(2838, 3539, 1);
		break;

		case 1738:
			if (p.absX == 2841 && p.absY == 3538 && p.heightLevel == 0)
				p.setCoords(2840, 3539, 2);
			else if (p.absX == 2840 && p.absY == 3539 && p.heightLevel == 2)
				p.setCoords(2841, 3538, 0);
		break;

		case 15644:
			if (p.absX == 2855 && p.absY == 3546 && p.heightLevel == 0)
				p.setCoords(2855, 3545, 0);
			else if (p.absX == 2855 && p.absY == 3545 && p.heightLevel == 0)
				p.setCoords(2855, 3546, 0);
			//Height 2
			if (p.absX == 2846 && p.absY == 3541 && p.heightLevel == 2) {
				if (Server.engine.playerItems.hasPlayerItemAmount(p, 8851, 100))
					p.setCoords(2847, 3541, 2);
				else
					p.frames.sendMessage(p, "You need at least 100 Warrior guild tokens to enter.");
			}
			if (p.absX == 2847 && p.absY == 3541 && p.heightLevel == 2)
				p.setCoords(2846, 3541, 2);
          		Misc.println("[" + p.username + "] Unhandled object 1: " + p.clickId);
		break;

		case 15641:
			if (p.absX == 2854 && p.absY == 3546 && p.heightLevel == 0)
				p.setCoords(2854, 3545, 0);
			else if (p.absX == 2854 && p.absY == 3545 && p.heightLevel == 0)
				p.setCoords(2854, 3546, 0);
			//Height 2
			if (p.absX == 2846 && p.absY == 3540 && p.heightLevel == 2) {
				if (Server.engine.playerItems.hasPlayerItemAmount(p, 8851, 100))
					p.setCoords(2847, 3540, 2);
				else
					p.frames.sendMessage(p, "You need at least 100 Warrior guild tokens to enter.");
			}
			if (p.absX == 2847 && p.absY == 3540 && p.heightLevel == 2)
				p.setCoords(2846, 3540, 2);
          		Misc.println("[" + p.username + "] Unhandled object 1: " + p.clickId);
		break;

		case 3832:
			p.setCoords(3510, 9499, 2);
		break;

		/*case 9368:
				if (p.absX == 2399 && p.absY == 5169 && p.heightLevel == 0) {
					p.setCoords(2399, 5167, fCave.getCaveHeight());
					p.frames.sendMessage(p, "You enter the Fight Cave.");
					p.waveDelay = 20;
				} else if (p.absX == 2399 && p.absY == 5167) {
					p.setCoords(2399, 5169, 0);
					p.frames.sendMessage(p, "You leave the Fight Cave.");
				}
					break;*/

		case 1816:
			p.teleportTo(2273, 4680, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
			break;

		case 1817:
			p.teleportTo(3067, 10254, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
			break;

		/**
		 * Enter Bandos stronghold	
	 	 */
		case 26384:
			if (p.getLevelForXP(2) > 69) {
				if (p.absX == 2851 && p.absY == 5333) {
					p.setCoords(2850, 5333, 2);
				} else if (p.absX == 2850 && p.absY == 5333) {
					p.setCoords(2851, 5333, 2);
				}
			} else {	
				p.frames.sendMessage(p, "You need a Strength level of 70 to enter Bandos's Stronghold.");
			}
		break;

		/**
		 * Enter saradomin part
		 */
		case 26444:
			if (p.absX == 2912 && p.absY == 5300) {
				p.setCoords(2914, 5300, 1);
			}
		break;

		/**
		 * Enter saradomin part 2
		 */
		case 26445:
			if (p.absX == 2920 && p.absY == 5276) {
				p.setCoords(2920, 5274, 0);
			}
		break;

		case 26427:
			if (p.absX == 2908 && p.absY == 5265) {
				if (p.godWarsKills[2] >= 5)
					p.setCoords(2907, 5265, 0);
				else
					p.frames.sendMessage(p, "You need atleast 5 Saradomin kills to enter this chamber.");
			}
			if (p.absX == 2907 && p.absY == 5265) {
				p.setCoords(2908, 5265, 0);
			}
		break;

		/**
		 * Enter Tsusaroth's chamber
		 */
		case 26428:
			if (p.absX == 2925 && p.absY == 5332) {
				if (p.godWarsKills[3] >= 10)
					p.setCoords(2925, 5331, 2);
				else
					p.frames.sendMessage(p, "You need atleast 10 Zamorak kills to enter this chamber.");
			}
			if (p.absX == 2925 && p.absY == 5331) {
				p.setCoords(2925, 5332, 2);
			}
		break;

		/**
		 * Enter/Exit Zamorak's fortress.
		 */
		case 26439:
			if (p.skillLvl[3] > 69) {
				if (p.absX == 2885 && p.absY == 5345) {
					p.frames.setOverlay(p, 601);	
					p.setCoords(2885, 5332, 2);
				} else	if (p.absX == 2885 && p.absY == 5332) {
					p.setCoords(2885, 5345, 2);
				}
			} else {
				p.frames.sendMessage(p, "You need atleast a hitpoint level of 70 to climb off the bridge.");
			}
		break;

		/**
		 * Enter/Exit Armadyl's Eyrie.
		 */
		case 26303:
			if (p.equipment[3] == 9185) {
				if (p.skillLvl[4] > 69) {
					if (Misc.getDistance(p.absX, p.absY, p.clickX, p.clickY) <= 11) {
						if (p.absX == 2871 && p.absY == 5269) {
							p.setCoords(2872, 5279, 2);
							p.frames.sendMessage(p, "You leave Armadyl's Eyrie.");
						} else {
							p.setCoords(2871, 5269, 2);
							p.frames.sendMessage(p, "You enter Armadyl's Eyrie.");
						}
					
					}
				} else {
					p.frames.sendMessage(p, "You need a ranged level of 70 to enter Armadyl's Eyrie.");
				}
			} else {
				p.frames.sendMessage(p, "You need a runite crossbow to enter Armadyl's Eyrie.");
			}
		break;

		case 2213:
		case 2693:
		case 4483:
		case 11402:
		case 16700:
		case 26972:
		case 36786:
			p.openBank();
		break;

		case 36776:
			p.setCoords(p.absX, p.absY, 2);
		break;

		case 36778:
			p.setCoords(p.absX, p.absY, 0);
		break;

		/**
		 * Mage arena
		 */
		case 5959:
		    if (p.absX == 3090 && p.absY == 3956) {
			p.teleportTo(2539, 4712, 0, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
		    }
		break;

		case 5960:
			p.frames.showInterface(p,574);
			break;

		case 733:
			if (p.clickX == 3095 && p.clickY == 3957) {
				if (p.absX == 3095) {
					p.setCoords(3094, 3957, 0);
				} else if (p.absX == 3094) {
					p.setCoords(3095, 3957, 0);
				}
			}
			if (p.clickX == 3092 && p.clickY == 3957) {
				if (p.absX == 3093) {
					p.setCoords(3092, 3957, 0);
				} else if (p.absX == 3092) {
					p.setCoords(3093, 3957, 0);
				}
			}
			if (p.clickX == 3105 && p.clickY == 3958) {
				if (p.absY == 3959) {
					p.setCoords(3105, 3957, 0);
				} else if (p.absY == 3957) {
					p.setCoords(3105, 3959, 0);
				}
			}
			if (p.clickX == 3106 && p.clickY == 3958) {
				if (p.absY == 3959) {
					p.setCoords(3106, 3957, 0);
				} else if (p.absY == 3957) {
					p.setCoords(3106, 3959, 0);
				}
			}
		break;
		case 9706:
			p.teleportTo(3105, 3951, 0, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
			break;
		case 9707:
			p.teleportTo(3105, 3956, 0, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
			break;

		/**
		 * God wars
		 */
		case 26425:
			if (!p.graardorChamber()) {
				if (p.godWarsKills[1] >= 10)
					p.setCoords(2865, 5354, 2);
				else
					p.frames.sendMessage(p, "You atleast need 10 Bandos kills to enter this Chamber.");
			} else {
				p.setCoords(2863, 5354, 2);
			}
		break;

		case 26426:
			if (!p.armadylChamber()) {
				if (p.godWarsKills[0] >= 15)
					p.setCoords(2839, 5296, 2);
				else
					p.frames.sendMessage(p, "You atleast need 15 Armadyl kills to enter this Chamber.");
			} else {
				p.setCoords(2839, 5295, 2);
			}
		break;

		case 28140:
			p.setCoords(3266 + Misc.random(2), 3692 + Misc.random(2), 0);
		break;

		/*case 23271:
			p.crossDitch();
		break;*/

         case 23271:
            p.jumpDelay = 3;
            if (p.absY > p.clickY) {
			p.frames.playSound(p, 2462, 1, 0);
			p.jumpUpdateReq = true;
                	p.reqWalkQueueBack(p.absX, p.clickY - 1);
            }
            if (p.absY < p.clickY) {
			p.frames.showInterface(p,382);
            }
            break;
		case 26289:
		case 26288:
		case 24343:
		case 27661:
			if (p.skillLvl[5] != p.getLevelForXP(5)) {
				p.requestAnim(645, 0);
				p.skillLvl[5] = p.getLevelForXP(5);
				p.frames.sendMessage(p, "You restore your prayer points.");
			} else {
				p.frames.sendMessage(p, "Your prayer points are still full.");
			}
			p.frames.setSkillLvl(p, 5);
			p.appearanceUpdateReq = true;
			p.updateReq = true;
		break;

			    case 28119:
		if(p.combatLevel > 67) {
		    p.frames.sendMessage(p, "Your combat level is too high for this crator.");
		    return;
		}
		Engine.BountyHunter.enter(p, 1);
		break;
	    case 28120:
		if(p.combatLevel < 55) {
		    p.frames.sendMessage(p, "Your combat level is too low for this crator.");
		    return;
		}
		if(p.combatLevel > 113) {
		    p.frames.sendMessage(p, "Your combat level is too high for this crator.");
		    return;
		}
		Engine.BountyHunter.enter(p, 2);
		break;
	    case 28121:
		if(p.combatLevel < 100) {
		    p.frames.sendMessage(p, "Your combat level is too low for this crator.");
		    return;
		}
		Engine.BountyHunter.enter(p, 0);
		break;
	    case 28122:
		int ii = p.heightLevel;
		if(ii == 0) {
		    Engine.BountyHunter.exit(p, 1);
		} else if(ii == 4) {
		    Engine.BountyHunter.exit(p, 2);
		} else if(ii == 8) {
		    Engine.BountyHunter.exit(p, 3);
		}
		break;
		//case 28119:
			//p.frames.showInterface(p,657);
			/*p.inLowBounty = true;
			p.resetAnimTimer = 7;
			p.teleportTo(3180, 3708, 4, 4, 0, 8858, 8859, 6000, 0, 6000, 0);
			p.frames.sendMessage(p, "You enter the crater.");*/
			//break;

		//case 28120:
			//p.frames.showInterface(p,657);	
			/*p.inMedBounty = true;
			p.resetAnimTimer = 7;
			p.teleportTo(3180, 3708, 8, 4, 0, 8858, 8859, 6000, 0, 6000, 0);
			p.frames.sendMessage(p, "You enter the crater.");*/
			//break;

		//case 28121:
			//p.frames.showInterface(p,657);
			/*p.inHighBounty = true;
			p.resetAnimTimer = 7;
			p.teleportTo(3180, 3708, 12, 4, 0, 8858, 8859, 6000, 0, 6000, 0);
			p.frames.sendMessage(p, "You enter the crater.");*/
			//break;

		/*case 28122:
		case 28123:
		case 28124:
			p.headIconSkull = -1;
			p.headIconPrayer = -1;*/
			/*p.inLowBounty = false;
			p.inMedBounty = false;
			p.inHighBounty = false;
			p.isInBounty = false;*/
			/*p.resetAnimTimer = 7;
			p.teleportTo(3158, 3680, 0, 4, 0, 8858, 8859, 6000, 0, 6000, 0);
			p.frames.sendMessage(p, "You leave the crater.");
			p.appearanceUpdateReq = true;
			p.updateReq = true;
		break;*/

        default:
            Misc.println("[" + p.username + "] Unhandled object 1: " + p.clickId);
            break;
        }
    }

	public Engine en;

    private int objectSize(int id) {
        switch (id) {
        default:
            return 1;
        }
    }
}
